class_name Hitbox
extends Area2D

signal hit(hurtbox)

func _init() -> void:
	# 设置在对象的area_entered信号中添加一个回调的处理函数
	area_entered.connect(_on_area_entered)

func _on_area_entered(hurtbox:Hurtbox):
	print("[Hit] %s => %s"%[owner.name,hurtbox.owner.name])
	hit.emit(hurtbox)
	hurtbox.hurt.emit(self)
